{template "header.html"}

<script type="application/javascript">
    $(function(){
        dr_set_value(0);
    });
    function dr_set_value(i) {
        $('.dr_type').hide();
        $('.dr_type_'+i).show();
    }
</script>
<form action="" class="form-horizontal" method="post" name="myform" id="myform">
    {$form}
    <div class="portlet bordered light myfbody">
        <div class="portlet-title">
            <div class="caption">
                <span class="caption-subject font-green-sharp">
                    {dr_lang('邮件群发')}
                </span>
            </div>
        </div>
        <div class="portlet-body">
            <div class="form-body">

                <div class="form-group">
                    <label class="col-md-2 control-label">{dr_lang('服务器')}</label>
                    <div class="col-md-9">
                        <label>
                        <select name="data[smtp]" class="form-control">
                            <option value="0"> {dr_lang('随机')}</option>
                            {loop $smtp $t}
                            <option value="{$t.id}">{$t.host}</option>
                            {/loop}
                        </select>
                        </label>
                    </div>
                </div><div class="form-group">
                    <label class="col-md-2 control-label">{dr_lang('接收人群')}</label>
                    <div class="col-md-9">
                        <div class="mt-radio-inline">
                            {loop $type $ii $name}
                            <label class="mt-radio">
                                <input onclick="dr_set_value('{$ii}')" {if $ii==$i}checked{/if} name="data[type]" type="radio" value="{$ii}"> {$name}
                                <span></span>
                            </label>
                            {/loop}
                        </div>
                    </div>
                </div>
                <div class="form-group dr_type_1 dr_type" style="display: none">
                    <label class="col-md-2 control-label">{dr_lang('邮箱地址')}</label>
                    <div class="col-md-7">
                        <input type="text" name="data[email]" class="form-control">
                    </div>
                </div>
                <div class="form-group dr_type_2 dr_type" style="display: none">
                    <label class="col-md-2 control-label">{dr_lang('邮箱地址')}</label>
                    <div class="col-md-7">
                        <textarea class="form-control" name="data[emails]" rows="6"></textarea>
                        <p class="help-block"> {dr_lang('批量发送一行一个邮箱地址')} </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">{dr_lang('邮件主题')}</label>
                    <div class="col-md-9">
                        <input type="text" name="data[title]" class="form-control">
                    </div>
                </div>
                {$myfield}

            </div>
        </div>
    </div>

    <div class="portlet-body form myfooter">
        <div class="form-actions text-center">
            <button type="button" onclick="dr_bfb_submit('{dr_lang('邮件群发')}', 'myform', '{dr_url('email/home/todo_add')}')" class="btn green"> <i class="fa fa-send"></i> {dr_lang('立即发送')} </button>
        </div>
    </div>
</form>

{template "footer.html"}